package com.ffyc.cms.service;

import com.ffyc.cms.controller.JournalismController;
import com.ffyc.cms.dao.JournalismDao;
import com.ffyc.cms.model.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class JournalismService {
    @Autowired
    JournalismDao journalismDao;

    public List<JournalismController> getjournalism(Integer state,Integer id) {
        return journalismDao.getjournalism(state,id);
    }

    public void passcheck(Integer id,Integer state) {
        journalismDao.passcheck(id,state);
    }

    public List<JournalismController> getjournalismByWriter(Admin admin) {
        return journalismDao.getjournalismByWriter(admin);
    }

    public Map<String, List> getjournalismnum() {
        Map<String,List> map = new HashMap<>();
        List<String> name = journalismDao.getNewsType();
        List<Integer> num = journalismDao.getnewsTypeNum();
        map.put("x",name);
        map.put("y",num);
        return map;
    }
}
